<%@page contentType="text/html;charset=utf-8"  pageEncoding="utf-8" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>小区车位管理系统</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/statics/css/bootstrap.min.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/statics/css/login.css">
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-offset-4 col-md-5" id="login_box">
            <div class="panel panel-primary">
                <div class="panel-heading">车位管理系统登陆</div>
                <div class="panel-body">
                    <form class="form-horizontal" id = 'login_form'>
                        <div class="form-group">
                            <label for="username" class="col-sm-3 control-label">用户名</label>
                            <div class="col-sm-8">
                                <input  class="form-control" id="username" name="username" placeholder="在此输入用户名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label  class="col-sm-3 control-label">密码</label>
                            <div class="col-sm-8">
                                <input type="password" class="form-control" name="password" id="password" placeholder="这里输入密码">
                            </div>
                        </div>
                       <%-- <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox">记住我
                                    </label>
                                   &lt;%&ndash; <a style="margin-left: 200px" href="#">注册</a>&ndash;%&gt;
                                </div>
                            </div>
                        </div>--%>
                        <div class="form-group">
                            <div class="col-sm-offset-8 col-sm-10">
                                <button id="login_btn" type="button" class="btn btn-default">登录</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script type="text/javascript" src="<%=request.getContextPath()%>/statics/js/jquery-3.3.1.min.js" ></script>
<script type="text/javascript">
    $("#login_btn").click(function () {
        $.ajax({
            type: "POST",
            url:"http://localhost:8888/home/login",
            data:$('#login_form').serialize(),// 你的formid
            dataType:"json",
            success: function(result){
                if(result.status == "2"){
                    window.location.href="http://localhost:8888/manage/index";
                }else if(result.status == "0"){
                    alert(result.msg);
                }else if(result.status == "1"){
                    alert(result.msg);
                }
            }
        });
    });
</script>

</html>
